import React, { Component } from 'react'
import PropTypes from 'prop-types'

export default function App() {
  const user={name:"Rose",age:20}
  return (
    <div>
      {/* <Child /> */}
      <Child arr={["java","vue"]} {...user} >
        <span>react的插槽</span>
        <p>react的插槽</p>
      </Child>
      
    </div>
  )
}



class Child extends Component{
  static PropsType={        //设置规则
    name:PropTypes.string.isRequired,
    sex:PropTypes.string,
    age:PropTypes.number
  }
  static defaultProps={
    sex:"nan",
    age:18
  }
  render(){
    return <>
    <ul>
      <li>姓名：{this.props.name}</li>
      <li>年龄：{this.props.age}</li>
      <li>性别：{this.props.sex}</li>
    </ul>
    arr--------{this.props.arr}
    {this.props.children[1]}
    {this.props.children[0]}
    
      <button onClick={()=>{console.log(this.props)}}>点击</button>
    </>
  }
}
